<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改合同')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-contract-edit" th:object="${doc}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目编号：</label>
                <div class="col-sm-8">
                    <input name="contractNo" th:field="*{contractNo}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目名称：</label>
                <div class="col-sm-8">
                    <input name="contractName" th:field="*{contractName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目类型：</label>
                <div class="col-sm-8">
                    <select name="projectType" class="form-control m-b" th:with="type=${@dict.getType('project_type')}" disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{projectType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">协议类型：</label>
                <div class="col-sm-8">
                    <select name="protocolType" class="form-control m-b" th:with="type=${@dict.getType('protocol_type')}" disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{protocolType}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">委托单位：</label>
                <div class="col-sm-8">
                    <input name="agency" th:field="*{agency}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目负责人：</label>
                <div class="col-sm-8">
                    <input name="chargeMan" th:field="*{chargeMan}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">单位：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input name="writtingsName" th:field="*{reportUnit}" class="form-control" type="text" required disabled>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">科室：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input name="writtingsName" th:field="*{department}" class="form-control" type="text" required disabled>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="startDate" th:value="${#dates.format(doc.startDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endDate" th:value="${#dates.format(doc.endDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">合同额：</label>
                <div class="col-sm-8">
                    <input name="contractAmount" th:field="*{contractAmount}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">摘要：</label>
                <div class="col-sm-8">
                    <textarea name="summary" class="form-control" disabled>[[*{summary}]]</textarea >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">总经费：</label>
                <div class="col-sm-8">
                    <input name="totalOutlay" th:field="*{totalOutlay}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">实到经费：</label>
                <div class="col-sm-8">
                    <input name="realOutlay" th:field="*{realOutlay}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">附件：</label>
                <div class="col-sm-8">
                    <ul class="list-group list-group-striped">
                        <li th:each="dict : ${appendices}" class="list-group-item">
                            <a  th:href="${dict.appendixLocation}"   target="_blank"><i class="fa fa-edit"></i>[[${dict.appendixName}]]</a>
                        </li>
                    </ul>
                </div>
            </div>
        </form>
    </div>
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-audit" >
            <input name="id" th:value="${approvalId}"  type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">审批意见：</label>
                <div class="col-sm-8">
                    <select name="auditState" class="form-control m-b" th:with="type=${@dict.getType('audit_result')}" >
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">审批备注：</label>
                <div class="col-sm-8">
                    <input name="remark"  class="form-control" type="text" >
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/approval";
        $("#form-writings-edit").validate({
            focusCleanup: true
        });


        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/audit", $('#form-audit').serialize());
            }
        }

        $("input[name='startDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='gmtTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#reportUnitId").change(function () {
            var t = $("#reportUnitId").val();
            if (t == '') {
                return;
            }

            $.ajax({
                url: ctx + 'system/dept/getDept',
                async: false,
                type: 'get',
                data: {unit: t},
                success: function (data) {
                    var t3 = $("#departmentId").empty();
                    t3.append("<option value=''> 所有</option>");
                    for (var i = 0; i < data.length; i++) {
                        t3.append("<option value='" + data[i].deptId + "'>" + data[i].deptName + "</option>");
                    }
                }
            })
        });
    </script>
</body>
</html>